/*
 * Copyright (C) 2005-present, 58.com.  All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.wuba.wlock.client.registryclient.entity;

public class DaemonCheckTask {

	private String hashKey;
	
	private String registryIP;
	
	private int registryPort;

	public DaemonCheckTask(String hashKey, String registryIP, int registryPort) {
		this.hashKey = hashKey;
		this.registryIP = registryIP;
		this.registryPort = registryPort;
	}
	
	public String getHashKey() {
		return hashKey;
	}

	public void setHashKey(String hashKey) {
		this.hashKey = hashKey;
	}

	public String getRegistryIP() {
		return registryIP;
	}

	public void setRegistryIP(String registryIP) {
		this.registryIP = registryIP;
	}

	public int getRegistryPort() {
		return registryPort;
	}

	public void setRegistryPort(int registryPort) {
		this.registryPort = registryPort;
	}
	
	public boolean isEqualObject(DaemonCheckTask task) {
		if (!this.hashKey.equals(task.getHashKey())) {
			return false;
		}
		if (!this.registryIP.equals(task.getRegistryIP())) {
			return false;
		}
		if (this.registryPort != task.registryPort) {
			return false;
		}
		return true;
	}
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("[").append("hashKey:").append(this.hashKey).append(" registryIP:").append(this.registryIP).append(" registryPort:").append(this.registryPort).append("]");
		return sb.toString();
	}
	
}
